#pragma once
#include<iostream>
#include<pthread.h>
#include<string>
#include<cstdio>
class thread_mutex{
public:
    thread_mutex(pthread_mutex_t * mut):_mutex_p(mut)
    {       
         *_mutex_p = PTHREAD_MUTEX_INITIALIZER;     
    }

    void lock()
    {      
        pthread_mutex_lock(_mutex_p);
    }

    void trylock()
    {
        pthread_mutex_trylock(_mutex_p);
    }


    void unlock()
    {
        pthread_mutex_unlock(_mutex_p);
    }

private:
    pthread_mutex_t* _mutex_p;
};